package com.xuecheng.content.controller;

import com.xuecheng.content.model.dto.AuditFailDTO;
import com.xuecheng.content.model.dto.AuditSuccessDTO;
import com.xuecheng.content.service.ICourseAuditService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @description: 课程审核接口
 * @author 勾新杰
 * @version 1.0
 * @date 2025/2/15 18:49
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/course-audit")
@Api(tags = "课程审核接口")
public class CourseAuditController {

    /**
     * 课程审核服务
     */
    private final ICourseAuditService courseAuditService;

    /**
     * 提交审核
     * @param courseId 课程id
     */
    @PostMapping("/commit/{courseId}")
    @ApiOperation("提交审核")
    public void commitAudit(@PathVariable Long courseId) {
        courseAuditService.commitAudit(courseId);
    }

    /**
     * 审核通过
     * @param courseId 课程id
     */
    @PostMapping("/success/{courseId}")
    @ApiOperation("审核通过")
    public void success(@PathVariable Long courseId, @RequestBody @Validated AuditSuccessDTO auditSuccessDTO){
        courseAuditService.success(courseId, auditSuccessDTO);
    }

    /**
     * 审核失败
     * @param courseId 课程id
     */
    @PostMapping("/fail/{courseId}")
    @ApiOperation("审核失败")
    public void fail(@PathVariable Long courseId, @RequestBody @Validated AuditFailDTO auditFailDTO){
        courseAuditService.fail(courseId, auditFailDTO);
    }
}
